package com.cy;

import org.apache.catalina.Server;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
public class ProviderApplication {
    public static void main(String[] args) {
        SpringApplication.run(ProviderApplication.class, args);

    }

    @RestController
    public class ProviderController {
        //@Value用于读取application的配置
        @Value("${server.port:8080}")
        private String server;

        @GetMapping("/provider/echo/{msg}")
        public String doRestEcho1(
                @PathVariable("msg") String msg) {
            return server + "say hello" + msg;
        }
    }
}
